package org.bot.plugin.window.event;

import com.alibaba.fastjson.JSONObject;
import org.bot.api.event.DataStorage;
import org.bot.api.event.EventName;
import org.bot.api.event.Events;
import org.bot.api.flow.FlowNode;
import org.bot.plugin.window.tool.WindowOperate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 沧月
 * @create 0013 2023/10/13 10:43
 * @description <description class purpose>
 */

@Component
@EventName("单击（window）")
public class WindowClick implements Events {

    @Autowired
    WindowOperate operate;

    @Override
    public Object exec(FlowNode note, DataStorage data) {
        String arg = note.getArg();
        JSONObject object = JSONObject.parseObject(arg);
        return operate.click(object.getIntValue("x"), object.getIntValue("y"));
    }

}
